/*
 * @Author: song
 * @Description:当前刻度
 * @Date: 2024年04月28日 星期日 20:04:19
 * @Modify:
 */

using SCore.Editor.WindowDraw;
using UnityEditor;
using UnityEngine;

namespace Function.SkillEditor.Editor
{
    public class SkillTimeLineEndCursorView : NCommonView
    {
        private SkillTimeLineMarkerView _markerView;

        public void Bind(SkillTimeLineMarkerView markerView)
        {
            _markerView = markerView;
        }

        public void OnEndCursorGUI()
        {
            if (Event.current.type == EventType.Repaint)
            {
                var parent = GetSubEditorWindow<SkillTimeLineSubWindow>();
                var curFrame = parent._skillConfigItem._skillRunLine._lengthFrame;

                float x = _markerView.GetXByFrame(curFrame);
                _rect = new Rect(x - 2, 23, 20, 40);


                EditorGUI.DrawRect(new Rect(_rect.x, _rect.y, 1, parent.GetPosition().height),
                    EditorDrawHelp._royalBlue);

                EditorDrawHelp._timeEndCursor.Draw(new Rect(_rect.x - 2, _rect.y, _rect.width, _rect.height),
                    new GUIContent(""), false, false,
                    false, false);
            }
        }
    }
}